package com.example.onedemotest.handle;

import ohos.eventhandler.EventHandler;
import ohos.eventhandler.EventRunner;
import ohos.eventhandler.InnerEvent;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;

public class MyEventHandler extends EventHandler {
    /**
     * 日志
     */
    private static final HiLogLabel label = new HiLogLabel(3, 0xD001100, "MyEventHandler");

    public MyEventHandler(EventRunner runner) throws IllegalArgumentException {
        super(runner);
    }


    /**
     * 1. 创建 EventHandler 的子类，在子类中重写实现方法 processEvent()来处理事件
     *
     * @param event
     */
    @Override
    protected void processEvent(InnerEvent event) {
        super.processEvent(event);
        if (event!=null){
            HiLog.info(label,"收到参数"+event.eventId+event.param);
        }
    }
}
